<template>
  <div class="layout">

    <!-- <GeoJsonLayer ref="map" /> -->
    <tdt-map></tdt-map>
    <Button class="loadpoint" @click="loadpoint">加载医院</Button>
    <!-- <Button class="begin" @click="load">加载行政区划</Button> -->
    <!-- <Modal v-model="showReviewModal">
      <h2>当前审查任务是否通过？</h2>
      <template slot="footer">
        <Button type="primary" size="large">通过</Button>
        <Button size="large">不通过</Button>
      </template>
    </Modal> -->
  </div>
</template>

<script>
import data from '../../assets/json/data'
import Point from '@arcgis/core/geometry/Point'
import Polygon from '@arcgis/core/geometry/Polygon'
import LabelClass from '@arcgis/core/layers/support/LabelClass'
import Legend from '@arcgis/core/widgets/Legend'

import PictureMarkerSymbol from '@arcgis/core/symbols/PictureMarkerSymbol'
import GraohicsLayer from '@arcgis/core/layers/GraphicsLayer'
import Graphic from '@arcgis/core/Graphic'
import Extent from '@arcgis/core/geometry/Extent'
import Color from '@arcgis/core/Color'

import shanghai from '@/assets/json/sh.json'
import Echarts from '@/views/Echarts.vue'
import FeatureLayer from '@arcgis/core/layers/FeatureLayer'
import FeatureSet from '@arcgis/core/rest/support/FeatureSet'
import GeoJsonLayer from '@/views/GeoJsonLayer.vue'
export default {
  name: 'dian',
  components: {
  },
  data() {
    return {
      level: {
        levelOne: '',
        levelTwo: '',
        levelThree: '',
        levelFour: ''
      },
      showReviewModal: false,
      shPolygon: shanghai
    }
  },



  mounted() {
    this.$nextTick(() => {
      
    })
  },
  methods: {
    loadpoint() {
      const hospitalfeature = data.ThemeData.hospital.features
      for (let i = 0; i < hospitalfeature.length; i++) {
        const ptsymbol = new PictureMarkerSymbol(
          require('@/assets/img/hospital.png'),
          20,
          20
        )

        const lonlat = hospitalfeature[i].geometry.coordinates
        const lon = lonlat[0]
        const lat = lonlat[1]
        const pt = new Point({
          type: 'point',
          longitude: lon,
          latitude: lat
        })
        const attr = {
          Name: hospitalfeature[i].properties.NAME,
          Addres: hospitalfeature[i].properties.ADDR,
          Phone: hospitalfeature[i].properties.TELEPHONE
        }
       const popupTemplate = {
                title:hospitalfeature[i].properties.NAME,
                content: [
                  {
                    // Pass in the fields to display
                    type: "fields",
                    fieldInfos: [
                      {
                        fieldName: "Name",
                        label: "Name",
                      },
                      {
                        fieldName: "Addres",
                        label: "Addres",
                      },
                      {
                        fieldName: "Phone",
                        label: "Phone",
                      },
                    ],
                  },
                ],
              };
        const pointGraphic = new Graphic({
          geometry: pt,
          symbol: ptsymbol,
          attributes: attr,
          popupTemplate: popupTemplate,
        })
        const ptGraohicsLayer = new GraohicsLayer()
        // ptGraohicsLayer.add(pointGraphic)
        // window.map.add(ptGraohicsLayer)
        window.view.graphics.add(pointGraphic)
      }
     

    }},

  }
</script>

<style lang="scss" scoped>
/deep/.btn {
  /* top: 25px; */
  left: 10px;
}
/deep/.ivu-layout-content {
  overflow-x: none;
}
.layout {
  height: 100%;
}
.echatrs {
  // background-color: #fff;
  position: absolute;
  top: 200px;
  left: 550px;
  width: 800px;
  z-index: 1;
  height: 500px;
}
.loadpoint {
  position: relative;
  left: 14px;
  bottom: 672px;
}
.begin {
  position: relative;
  left: 20px;
  bottom: 672px;
}
</style>
<style lang="scss" scoped>
/deep/.ivu-layout-content {
  overflow-x: none;
}
.ivu-modal {
  .ivu-modal-header {
    padding: 0.2rem 0.7rem;
    .modal-title {
      height: 2rem;
      line-height: 2rem;
      font-size: 1.5rem;
      .quitIcon {
        cursor: pointer;
        margin-top: 0.3rem;
        float: right;
      }
    }
  }
  .ivu-modal-body {
    height: 250px;
    .evaluation-modal-body {
      height: 100%;
      .uploadStyle {
        height: 100%;
        .ivu-upload.ivu-upload-drag {
          height: 100%;
          div {
            padding: 52.5px 0;
          }
        }
      }
    }
  }
}
</style>
